package cn.yy.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Matirialunit entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "matirialunit", catalog = "phoneerp")
public class Matirialunit implements java.io.Serializable {

	// Fields

	private Integer unitId;
	private String unitName;
	private Set<Outmatirial> outmatirials = new HashSet<Outmatirial>(0);
	private Set<Inmatirial> inmatirials = new HashSet<Inmatirial>(0);

	// Constructors

	/** default constructor */
	public Matirialunit() {
	}

	/** minimal constructor */
	public Matirialunit(String unitName) {
		this.unitName = unitName;
	}

	/** full constructor */
	public Matirialunit(String unitName, Set<Outmatirial> outmatirials,
			Set<Inmatirial> inmatirials) {
		this.unitName = unitName;
		this.outmatirials = outmatirials;
		this.inmatirials = inmatirials;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "unitId", unique = true, nullable = false)
	public Integer getUnitId() {
		return this.unitId;
	}

	public void setUnitId(Integer unitId) {
		this.unitId = unitId;
	}

	@Column(name = "unitName", nullable = false, length = 10)
	public String getUnitName() {
		return this.unitName;
	}

	public void setUnitName(String unitName) {
		this.unitName = unitName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "matirialunit")
	public Set<Outmatirial> getOutmatirials() {
		return this.outmatirials;
	}

	public void setOutmatirials(Set<Outmatirial> outmatirials) {
		this.outmatirials = outmatirials;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "matirialunit")
	public Set<Inmatirial> getInmatirials() {
		return this.inmatirials;
	}

	public void setInmatirials(Set<Inmatirial> inmatirials) {
		this.inmatirials = inmatirials;
	}

}